package com.company.bookstore.security;


import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

/**
 * UsernamePasswordToken
 * User 用户专属token
 * @blame Android Team
 */
public class UsernamePasswordToken  extends UsernamePasswordAuthenticationToken {
    // ~ Constructors
    // ===================================================================================================

    /**
     * This constructor can be safely used by any code that wishes to create a
     * <code>UsernamePasswordAuthenticationToken</code>, as the {@link #isAuthenticated()}
     * will return <code>false</code>.
     *
     */
    public UsernamePasswordToken(Object principal, Object credentials) {
        super(principal,credentials);
        super.setAuthenticated(false);
    }
    public UsernamePasswordToken(Object principal, Object credentials,
                                  Collection<? extends GrantedAuthority> authorities) {
        super(principal,credentials,authorities);
        super.setAuthenticated(true);
    }
}
